package br.usp.pcs.basys2.event;

import java.util.Calendar;

import br.usp.pcs.basys2.BasysProcess;
import br.usp.pcs.basys2.engine.BasysSystem;
import br.usp.pcs.basys2.engine.Engine;

public class InterruptionForPeripheralEvent extends Event {

	private String peripheralName;
	
	public InterruptionForPeripheralEvent(BasysProcess process, Calendar dateOfArrival, String peripheralName) {
		super(process, dateOfArrival);
		this.peripheralName = peripheralName;
	}

	public String getPeripheralName() {
		return peripheralName;
	}

	@Override
	public void execute() {
		BasysSystem system = Engine.getInstance().getSystem();
		system.getProcessorManager().interruptReached(this.getProcess());
		system.getPeripheralManager().get(peripheralName).requestAcess(getProcess());
	}
	

}
